Deprecated: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated in /home/kornich/htdocs/kornich.com/framework/Response.php on line 430
Whoops! There was an error.
Exception
Template not found: js/thonem_js Exception thrown with message "Template not found: js/thonem_js" Stacktrace: #9 Exception in /home/kornich/htdocs/kornich.com/framework/Response.php:431 #8 Response:compileTemplateWithLayout in /home/kornich/htdocs/kornich.com/framework/Response.php:321 #7 Response:render in /home/kornich/htdocs/kornich.com/framework/helpers/Core_helper.php:2918 #6 generateJs in /home/kornich/htdocs/kornich.com/modules/system/controllers/Home.php:14 #5 Home:index in /home/kornich/htdocs/kornich.com/framework/Router.php:241 #4 Router:detect in /home/kornich/htdocs/kornich.com/framework/Router.php:197 #3 Router:run in /home/kornich/htdocs/kornich.com/framework/Thonem.php:195 #2 Thonem:run in /home/kornich/htdocs/kornich.com/framework/Request.php:50 #1 Request:run in /home/kornich/htdocs/kornich.com/Bootstrap.php:97 #0 require_once in /home/kornich/htdocs/kornich.com/index.php:12
Stack frames (10)
9
Exception
/framework/Response.php:431
8
Response compileTemplateWithLayout
/framework/Response.php:321
7
Response render
/framework/helpers/Core_helper.php:2918
6
generateJs
/modules/system/controllers/Home.php:14
5
Home index
/framework/Router.php:241
4
Router detect
/framework/Router.php:197
3
Router run
/framework/Thonem.php:195
2
Thonem run
/framework/Request.php:50
1
Request run
/Bootstrap.php:97
0
require_once
/index.php:12
/home/kornich/htdocs/kornich.com/framework/Response.php
            throw new \Exception("Template not found: $path");
        }
 
        $content = file_get_contents($templatePath);
        $content = str_replace("__DIR__", '"' . dirname($templatePath) . '"', $content);
 
        self::ensureDirectories([dirname(self::$_thonem_cached_template)]);
        file_put_contents(self::$_thonem_cached_template, OutputProcessor($content));
    }
 
    /**
     * Compile template with layout
     * @param string $template
     */
    private static function compileTemplateWithLayout(string $template): void
    {
        $templatePath = self::compileTemplate($template, self::$interface);
 
        if (!file_exists($templatePath)) {
            throw new \Exception("Template not found: $template");
        }
 
        $layoutPath = self::getTemplate("layout/" . self::$layout, self::$interface);
        $templateContent = file_get_contents($templatePath);
 
        $content = file_exists($layoutPath)
            ? str_replace('{layout}', $templateContent, file_get_contents($layoutPath))
            : $templateContent;
 
        $content = str_replace("__DIR__", '"' . dirname($templatePath) . '"', $content);
 
        self::ensureDirectories([dirname(self::$_thonem_cached_template)]);
        file_put_contents(self::$_thonem_cached_template, ($content));
    }
 
    /**
     * Render compiled template
     * @param array|null $data
     * @return string
     */
/home/kornich/htdocs/kornich.com/framework/Response.php
        if ($interface) {
            self::$interface = $interface;
        }
 
        if ($module) {
            self::$module = $module;
        }
 
        self::$_thonem_data = array_merge($data, [
            "config" => (object)\Library\Configurations::$data,
            "prop" => (object)self::$props,
            "template_folder" => self::$interface ?: "general"
        ]);
 
        $cacheKey = str_replace("/", "*", $template) . '$' . md5($template);
        self::$_thonem_cached_template = TEMPLATES_CACHE_PATH . self::$_thonem_data["template_folder"] . "/" . $cacheKey . ".template";
 
        if (1){//!file_exists(self::$_thonem_cached_template) || DEBUG) {
            self::loadThemeAssets();
            self::compileTemplateWithLayout($template);
        }
 
        $buffer = self::renderTemplate();
 
        if ($return) {
            self::$interface = $originalInterface;
            return $buffer;
        }
 
        self::sendOutput($buffer);
 
        if (PROFILER && self::$layout !== "ajax") {
            Timeline::mark('Fully rendered');
            Debugger::render();
        }
 
        self::$interface = $originalInterface;
        return null;
    }
 
/home/kornich/htdocs/kornich.com/framework/helpers/Core_helper.php
        MODULES_PATH . "system/assets/js/jquery.min.js",
        MODULES_PATH . "system/assets/js/jquery-ui.min.js",
        MODULES_PATH . "system/assets/js/angular/angular.js",
        MODULES_PATH . "system/assets/js/angular/angular-sanitize.js",
        MODULES_PATH . "system/assets/js/angular/angular-route.js",
        MODULES_PATH . "system/assets/js/angular/angular-resource.js",
        MODULES_PATH . "system/assets/js/angular/angular.ui.sortable.js",
        MODULES_PATH . "system/assets/js/datetimepicker/bootstrap-datetimepicker.js",
        MODULES_PATH . "system/assets/js/swal.js",
        MODULES_PATH . "system/assets/js/toastr.min.js",
        MODULES_PATH . "system/assets/js/input_filter.js",
        MODULES_PATH . "system/assets/js/intlTelInput.min.js",
        MODULES_PATH . "system/assets/libs/select2/js/select2.min.js",
    ];
 
    $modulePaths = implode(",", array_column(active_modules(), 'path'));
    $pattern = MODULES_PATH . "{" . $modulePaths . "}/js/{thonem,$interface-$lang,$interface}.js";
    $data["files"] = array_merge($data["files"], glob($pattern, GLOB_BRACE));
 
    $js = \Response::render("js/thonem_js", $data, true, "system", "frontend", "ajax");
 
    $js = \JShrink\Minifier::minify($js, array('flaggedComments' => false));
 
    rmkdir(JS_PATH);
 
    file_put_contents(JS_PATH . "$interface-$lang.js", $js);
 
    return $js;
}
 
/**
 * @param $i
 * @param $lang
 * @return String
 */
function generateCss($interface, $lang = LANG)  {
 
    $data["files"] = [];
    $css = '';
    $modulePaths = implode(",", array_column(active_modules(), 'path'));
/home/kornich/htdocs/kornich.com/modules/system/controllers/Home.php
<?php
 
class Home extends FrontendController
{
    public function index()
    {
        Response::setLayout("ajax");
 
        $i = "frontend";
        $lang = LANG;
 
        if (!file_exists(JS_PATH . "$i-$lang.js") or DEBUG){
            foreach(["admin", "backstage", "frontend"] as $i)
                generateJs($i, $lang);
        }
 
        if (!file_exists(CSS_PATH . "$i-$lang.css") or DEBUG){
            foreach(["admin", "backstage", "frontend"] as $i)
                generateCSS($i, $lang);
        }
 
        $home = \Config::get("system", "homepage_route");
 
        if ( $home)
            redirect($home);
 
        Response::render("home");
    }
}
 
/home/kornich/htdocs/kornich.com/framework/Router.php
 
        $controllerInstance = new $Route['controller'];
 
        // GET ACTION TO RUN (DEFAULT TO 'index' IF NOT PROVIDED)
        $method = isset($this->segments[$Route['method'] + 1]) ? $this->segments[$Route['method'] + 1] : 'index';
 
        // If the method doesn't exist, try 'index' by default
        if (!method_exists($controllerInstance, $method)) {
            if (method_exists($controllerInstance, 'index')) {
                $method = 'index';
            } else {
                \Thonem::error404();
            }
        }
 
        // GET PARAMS
        $params = array_slice($this->segments, $Route['method'] + 2, count($this->segments) - 1);
 
        // RUN THE CONTROLLER METHOD
        return $controllerInstance->{$method}(...$params);
    }
 
    /**
     * Search for the controller
     * @param $segment
     * @return array|bool
     */
    private function getController($segment = 0)
    {
        global $ThonemMap;
 
        if (count($this->segments) - 1 < $segment)
            return false;
 
        if (isset($this->segments[$segment + 1])) {
            if (isset($ThonemMap->Controller->{$this->segments[$segment] . '/' . ucfirst($this->segments[$segment + 1])})) {
                $suggestController = $ThonemMap->Controller->{$this->segments[$segment] . '/' . ucfirst($this->segments[$segment + 1])};
 
                if ($suggestController) {
                    return [
/home/kornich/htdocs/kornich.com/framework/Router.php
 
        foreach ($this->route as $pattern => $real_route) {
            // Use the built-in delimiter and avoid manually adding slashes
            $pattern = "#^" . str_replace(array_keys($this->replace), array_values($this->replace), $pattern) . "$#u";
 
            // Check if $real_route is an array or a string
            if (preg_match($pattern, $this->current, $match)) {
                if (is_array($real_route)) {
                    // If $real_route is an array, decide how to handle it (e.g., join into a string)
                    // Example: join the array into a string, or handle appropriately for your use case
                    $real_route_string = implode('/', $real_route);  // Example: You can change this logic
                    $this->segments = explode('/', preg_replace($pattern, $real_route_string, $this->current));
                } else {
                    // If $real_route is already a string, just proceed
                    $this->segments = explode('/', preg_replace($pattern, $real_route, $this->current));
                }
            }
        }
 
        return $this->detect();
    }
 
    /**
     * DETECT THE CURRENT ROUTE
     */
    public function detect()
    {
        // IT'S NOT THE DEFAULT ROUTE, FIND THE MENTIONED CONTROLLER
        $Route = $this->getController();
 
        if (isset($Route["module"]))
            define("MODULE", $Route["module"]);
        else
            define("MODULE", false);
 
        if (!$Route)
            \Thonem::error404();
 
        if (preg_match("/" . str_replace(['/', '*'], ['\\' . '/', '([a-zA-Z0-9_-]+)'], MODULES_PATH . "*/controllers/") . "/", $Route['path'], $res)) {
            \Thonem::$currentModule = $res[1];
/home/kornich/htdocs/kornich.com/framework/Thonem.php
    /**
     * Main function of the framework to run
     */
    public static function run()
    {
        if(DEBUG){
            self::add(new Debug());
        }
 
        self::add(new Loader());
 
        self::get("Loader")->boot();
 
        (new \Library\Ban())->run();
 
//        self::get("Router")->get('/blog/', 'Blog@index');
//        self::get("Router") ->post('/submit', 'FormController@submit');
//        self::get("Router")->dispatch(Request::$URI, Request::$METHOD);
 
        self::get("Router")->run();
    }
 
    public static function ao($object, $path, $default_value = null){
        foreach(explode(".", $path) as $key) {
            if(is_object($object)) {
                if(!isset($object->$key))
                    return $default_value;
                $object = $object->$key;
            }
 
            if(is_array($object)) {
                if(!isset($object[$key]))
                    return $default_value;
                $object = $object[$key];
            }
        }
        return $object;
    }
 
    public static function getMap(){
/home/kornich/htdocs/kornich.com/framework/Request.php
        // Finalize URI processing
        self::$URI = trim($uri, '/');
 
        // Set request method and headers
        self::$METHOD = $_SERVER['REQUEST_METHOD'] ?? 'GET';
        self::$HEADERS = self::getAllHeaders();
 
        // Check for maintenance mode
        if (CLOSE && !DEBUG) {
            Thonem::underMaintenance(1010);
        }
 
        // Process JSON input
        self::processJsonInput();
 
        // Load composer autoload if exists
        self::loadVendorAutoload();
 
        // Run the application
        (new \Thonem())->run();
 
        define('THONEM_END_TIME', microtime(true));
    }
 
    private static function validateHost(): void {
        if (!CLI_MODE && parse_url(URL, PHP_URL_HOST) != ($_SERVER["HTTP_HOST"] ?? '')) {
            header("location: ".URL);
            exit;
        }
    }
 
//    private static function determineUri(): string {
//        if (CLI_MODE) {
//            return $_SERVER['argv'][1] ?? '/';
//        }
//
//        // Determine routing path
//        self::$ROUTING_PATH = strtoupper($_ENV["ROUTING_PATH"] ?? '');
//
//        if (self::$ROUTING_PATH == "AUTO") {
/home/kornich/htdocs/kornich.com/Bootstrap.php
    }
});
 
try {
    if(PROFILER){
        Debugger::init();
        Timeline::mark('Bootstrap Start');
    }
 
    header_remove("Server");
    header("Server: Thonem v". VERSION);
    header("X-Powered-By: Thonem");
    header("Powered-By: Thonem");
    header("Thonem-Version:". VERSION);
    header("Thonem-Token:". rand(000000,999999));
    if(PROFILER){
        Timeline::mark('Controller Invoked');
        $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
    }
    Request::run();
 
} catch (Exception $e) {
    $error = [
        "message" => $e->getMessage(),
        "file" => $e->getFile(),
        "line" => $e->getLine(),
        "code" => $e->getCode(),
        "trace" => $e->getTrace()
    ];
 
    if (DEBUG) {
        if(PROFILER)
        Debugger::addPanel(new ErrorPanel());
        $prettyHandler = new Whoops\Handler\PrettyPageHandler();
        $whoops = new \Whoops\Run;
        $whoops->allowQuit(false);
        $whoops->writeToOutput(false);
        $whoops->pushHandler(function ($e, $inspector, $run) {
            if(PROFILER)
            ErrorPanel::capture($e);
/home/kornich/htdocs/kornich.com/index.php
<?php
 
declare(strict_types=1);
 
if(isset($_SERVER['REQUEST_URI'])) {
    $clean_uri = strtok($_SERVER['REQUEST_URI'], '?');
    $_SERVER['REQUEST_URI'] = $clean_uri;
}
 
define("THONEM_IDX", __DIR__.'/');
 
require_once __DIR__."/Bootstrap.php";

Environment & details:

empty
empty
empty
empty
empty
Key Value
USER kornich
HOME /home/kornich
HTTP_X_FORWARDED_PROTO https
HTTP_CF_VISITOR {"scheme":"https"}
HTTP_CF_IPCOUNTRY US
HTTP_CF_CONNECTING_IP 216.73.216.136
HTTP_CDN_LOOP cloudflare; loops=1
HTTP_CF_RAY 96fb9ebb0fc2aa9a-YYZ
HTTP_ACCEPT_ENCODING gzip, br
HTTP_REFERER https://kornich.com/%D9%85%D8%AD%D9%84%20%D9%84%D9%84%D8%A8%D9%8A%D8%B9%2058%20%D9%85%20%D8%A7%D9%84%D8%B4%D8%A7%D8%B7%D8%A8%D9%8A%20(%D8%B4%20%D8%A8%D9%88%D8%B1%D8%B3%D8%B9%D9%8A%D8%AF%20)
HTTP_ACCEPT */*
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_CONNECTION close
HTTP_X_FORWARDED_FOR 216.73.216.136, 172.70.80.31
HTTP_X_REAL_IP 172.70.80.31
HTTP_X_FORWARDED_HOST kornich.com
PHP_VALUE error_log=/home/kornich/logs/php/error.log; memory_limit=1G; max_execution_time=120; max_input_time=60; max_input_vars=10000; post_max_size=64M; upload_max_filesize=64M; date.timezone=UTC; display_errors=off;
HTTPS on
MGT 1
GEOIP_LONGITUDE
GEOIP_LATITUDE
GEOIP_CITY_CONTINENT_CODE
GEOIP_POSTAL_CODE
GEOIP_CITY
GEOIP_REGION
GEOIP_CITY_COUNTRY_NAME
GEOIP_CITY_COUNTRY_CODE3
GEOIP_CITY_COUNTRY_CODE
GEOIP_COUNTRY_NAME United States
GEOIP_COUNTRY_CODE3 USA
GEOIP_COUNTRY_CODE US
REDIRECT_STATUS 200
HTTP_HOST kornich.com
SERVER_NAME kornich.com
SERVER_PORT 443
SERVER_ADDR 127.0.0.1
REMOTE_PORT
REMOTE_ADDR 216.73.216.136
SERVER_SOFTWARE nginx/1.28.0
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.0
DOCUMENT_ROOT /home/kornich/htdocs/kornich.com
DOCUMENT_URI /index.php
REQUEST_URI /en/
SCRIPT_NAME /index.php
SCRIPT_FILENAME /home/kornich/htdocs/kornich.com/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1755291611.4375
REQUEST_TIME 1755291611
Key Value
URL https://kornich.com/
DEBUG 1
DEBUG_SECRET KORNICH$$
CONFIG_SECRET THONEMSECRETSSS((*&^^)
DEMO
CRONJOB 1
MULTI_LANGUAGE 1
ASSETS_CACHE
PROFILER
PROFILER_SECRET THONEM
PROFILER_LOG 1
PROFILER_PRINT 1
DEFAULT_LANGUAGE en
SESSION_NAME THONEM
ENCRYPTION_KEY
IKEY
TIMEZONE Africa/Cairo
CLOSE
ROUTING_PATH REQUEST_URI
TOKEN token
WEBSOCKET_ENABLED
WEBSOCKET_SECURED
WEBSOCKET_PORT 9999
WEBSOCKET_HOST ws://localhost
DATABASE_HOSTNAME localhost
DATABASE_USERNAME kornich-thonem
DATABASE_PASSWORD kornich-thonem##
DATABASE_NAME kornich-thonem
DATABASE_DRIVER mysql
DATABASE_CHARSET utf8
CSRF_SECRET_KEY "8c81e70afdwer7ac6ec439180572f71998369388d0670a879fa018372689c6e4b7e00bdf2b7560bbbb6ac5c382790c223fa6bb2c1be0a6390c7470c6e1d348dca"
CSRF_TOKEN_LIFETIME 30 * 60
COMPRESS_OUTPUT 1
LANG en
0. Whoops\Handler\CallbackHandler
1. Whoops\Handler\PrettyPageHandler